layui.use(['layer', 'form', 'table', 'admin', 'ax'], function () {
    var $ = layui.$;
    var layer = layui.layer;
    var form = layui.form;
    var table = layui.table;
    var $ax = layui.ax;
    var admin = layui.admin;

    /**
     * 系统管理--字典管理
     */
    var Dict = {
        tableId: "dictTable",    //表格id
        condition: {
            condition: ""
        }
    }

    Dict.purchaseComplete = function (data) {
        var operation = function () {
            var ajax = new $ax(Feng.ctxPath + "/runbatch/purchaseComplete", function (data) {
                Feng.success("跑批成功!");
            }, function (data) {
                Feng.error("跑批失败!" + data.responseJSON.message + "!");
            });
            ajax.start();
        };
        Feng.confirm("是否进行跑批?", operation);
    };

    Dict.synchronizedUserData = function (data) {
        var operation = function () {
            var ajax = new $ax(Feng.ctxPath + "/runbatch/synchronizedUserData", function (data) {
                Feng.success("跑批成功!");
            }, function (data) {
                Feng.error("跑批失败!" + data.responseJSON.message + "!");
            });
            ajax.start();
        };
        Feng.confirm("是否进行跑批?", operation);
    };
    Dict.synchronizedMaterialData = function (data) {
        var operation = function () {
            var ajax = new $ax(Feng.ctxPath + "/runbatch/synchronizedMaterialData", function (data) {
                Feng.success("跑批成功!");
            }, function (data) {
                Feng.error("跑批失败!" + data.responseJSON.message + "!");
            });
            ajax.start();
        };
        Feng.confirm("是否进行跑批?", operation);
    };

    Dict.meterReading = function (data) {
        var operation = function () {
            var ajax = new $ax(Feng.ctxPath + "/runbatch/getMeterReadingData", function (data) {
                Feng.success("跑批成功!");
            }, function (data) {
                Feng.error("跑批失败!" + data.responseJSON.message + "!");
            });
            ajax.start();
        };
        Feng.confirm("是否进行跑批?", operation);
    };

   /* Dict.meterModel = function (data) {
        var operation = function () {
            var ajax = new $ax(Feng.ctxPath + "/runbatch/getMeterModelData", function (data) {
                Feng.success("跑批成功!");
            }, function (data) {
                Feng.error("跑批失败!" + data.responseJSON.message + "!");
            });
            ajax.start();
        };
        Feng.confirm("是否进行跑批?", operation);
    };*/

    // 物料不足跑批
    $('#purchaseComplete').click(function () {
        Dict.purchaseComplete();
    });
    // 同步用户信息跑批
    $('#synchronizedUserData').click(function () {
        Dict.synchronizedUserData();
    });
    // 同步主物料信息跑批
    $('#synchronizedMaterialData').click(function () {
        Dict.synchronizedMaterialData();
    });
    //生成当月抄表信息
    $('#meterReading').click(function () {
        Dict.meterReading();
    });
    //生成当月广告位和临时场地抄表信息
    /*$('#meterModel').click(function () {
        Dict.meterModel();
    });*/

});
